<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1 id="example">DOM复习</h1>
    <h1 class="yp">BOM对象</h1>
    <h1 class="yp">哈哈</h1>
    <script>

        window.onload = function () {//网页加载完毕事件
            var g = document.getElementsByTagName("h1");
            var c=document.getElementsByClassName("yp");
            for(let i in c){
                c[i].innerHTML=i;
            }
            console.log(g);
        }
    </script>
</body>

</html>